class Solution {
public:
    int findClosestNumber(vector<int>& nums) {
        int mymax=nums[0];
        for(auto& x:nums)
        {
            if(abs(x)<abs(mymax)||(abs(x)==abs(mymax)&&x>0))
            {
                mymax=x;
            }
        }
        return mymax;
    }
};
